package conf

import (
	"fmt"
	"github.com/spf13/viper"
)

type Config struct {
	MysqlConfig
}
type MysqlConfig struct {
	User     string
	Password string
	Host     string
	Port     int
	Database string
}

var AppConfig Config

func Init() {
	viper.SetConfigFile("./conf/config.yaml")
	if err := viper.ReadInConfig(); err != nil {
		fmt.Println("配置文件读取失败")
		return
	}
	if err := viper.Unmarshal(&AppConfig); err != nil {
		fmt.Println("解析失败")
		return
	}
}
